

#pragma once

#include "zDbLinkedTableData.h"
#include "zDbTableIterator.h"

struct UcGridProperty
{
    UcDb::GridProperty  mnPropMask;
    UcDb::GridLineStyle mnLineStyle;
    UcDb::LineWeight    mnLineWeight;
    UcDbHardPointerId   mLinetype;
    UcCmColor           mColor;
    UcDb::Visibility    mnVisibility;
    double              mfDoubleLineSpacing;
};

class UcDbFormattedTableData : public UcDbLinkedTableData
{
public:
    UCDB_DECLARE_MEMBERS(UcDbFormattedTableData);

    UCDB_PORT UcDbFormattedTableData(void);
    UCDB_PORT ~UcDbFormattedTableData(void);

    UCDB_PORT virtual int insertRowAndInherit(int nIndex, 
                                             int nInheritFrom,
                                             int nNumRows);
    UCDB_PORT virtual int insertColumnAndInherit(int nIndex, 
                                             int nInheritFrom,
                                             int nNumCols);

    UCDB_PORT virtual Ucad::ErrorStatus setFieldId(int nRow, 
                                             int nCol, 
                                             const UcDbObjectId& idField, 
                                             UcDb::CellOption nFlag);
    UCDB_PORT virtual Ucad::ErrorStatus setFieldId(int nRow, 
                                             int nCol, 
                                             int nIndex, 
                                             const UcDbObjectId& idField, 
                                             UcDb::CellOption nFlag);

    UCDB_PORT virtual Ucad::ErrorStatus merge(const UcCellRange& range);
    UCDB_PORT virtual Ucad::ErrorStatus unmerge(const UcCellRange& range);
    UCDB_PORT virtual bool isMerged         (int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual UcCellRange getMergeRange(int nRow, 
                                             int nCol) const;

    UCDB_PORT virtual bool isFormatEditable (int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual double rotation       (int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual double rotation       (int nRow, 
                                             int nCol,
                                             int nIndex) const;
    UCDB_PORT virtual Ucad::ErrorStatus setRotation(int nRow, 
                                             int nCol, 
                                             double fRotation);
    UCDB_PORT virtual Ucad::ErrorStatus setRotation(int nRow, 
                                             int nCol, 
                                             int nContent,
                                             double fRotation);
    UCDB_PORT virtual double scale          (int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual double scale          (int nRow, 
                                             int nCol,
                                             int nContent) const;
    UCDB_PORT virtual Ucad::ErrorStatus setScale(int nRow, 
                                             int nCol, 
                                             double fScale);
    UCDB_PORT virtual Ucad::ErrorStatus setScale(int nRow, 
                                             int nCol, 
                                             int nIndex,
                                             double fScale);
    UCDB_PORT virtual bool isAutoScale      (int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual bool isAutoScale      (int nRow, 
                                             int nCol,
                                             int nContent) const;
    UCDB_PORT virtual Ucad::ErrorStatus setAutoScale(int nRow, 
                                             int nCol, 
                                             bool bAutoScale);
    UCDB_PORT virtual Ucad::ErrorStatus setAutoScale(int nRow, 
                                             int nCol, 
                                             int nContent,
                                             bool bAutoScale);
    UCDB_PORT virtual UcDb::CellAlignment alignment(int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual Ucad::ErrorStatus setAlignment(int nRow, 
                                             int nCol, 
                                             UcDb::CellAlignment nAlignment);
    UCDB_PORT virtual UcCmColor contentColor(int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual UcCmColor contentColor(int nRow, 
                                             int nCol,
                                             int nContent) const;
    UCDB_PORT virtual Ucad::ErrorStatus setContentColor(int nRow, 
                                             int nCol, 
                                             const UcCmColor& color);
    UCDB_PORT virtual Ucad::ErrorStatus setContentColor(int nRow, 
                                             int nCol, 
                                             int nContent,
                                             const UcCmColor& color);
    UCDB_PORT virtual UcDbObjectId textStyle(int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual UcDbObjectId textStyle(int nRow, 
                                             int nCol,
                                             int nContent) const;
    UCDB_PORT virtual Ucad::ErrorStatus setTextStyle(int nRow, 
                                             int nCol, 
                                             const UcDbObjectId& idTextStyle);
    UCDB_PORT virtual Ucad::ErrorStatus setTextStyle(int nRow, 
                                             int nCol, 
                                             int nContent,
                                             const UcDbObjectId& idTextStyle);
    UCDB_PORT virtual double textHeight     (int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual double textHeight     (int nRow, 
                                             int nCol,
                                             int nContent) const;
    UCDB_PORT virtual Ucad::ErrorStatus setTextHeight(int nRow, 
                                             int nCol, 
                                             double fTextHeight);
    UCDB_PORT virtual Ucad::ErrorStatus setTextHeight(int nRow, 
                                             int nCol,
                                             int nContent,
                                             double fTextHeight);
    UCDB_PORT virtual UcCmColor backgroundColor(int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual Ucad::ErrorStatus setBackgroundColor(int nRow, 
                                             int nCol, 
                                             const UcCmColor& color);
    UCDB_PORT virtual UcDb::CellContentLayout contentLayout(int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual Ucad::ErrorStatus setContentLayout(int nRow, 
                                             int nCol, 
                                             UcDb::CellContentLayout nLayout);

    UCDB_PORT virtual UcDb::FlowDirection flowDirection(void) const;
    UCDB_PORT virtual Ucad::ErrorStatus setFlowDirection(UcDb::FlowDirection nDir);
    UCDB_PORT virtual double margin         (int nRow, 
                                             int nCol, 
                                             UcDb::CellMargin nMargin) const;
    UCDB_PORT virtual Ucad::ErrorStatus setMargin(int nRow, 
                                             int nCol, 
                                             UcDb::CellMargin nMargins, 
                                             double fMargin);
    UCDB_PORT virtual bool isMergeAllEnabled(int nRow, 
                                             int nCol) const;
    UCDB_PORT virtual Ucad::ErrorStatus enableMergeAll(int nRow, 
                                             int nCol,
                                             bool bEnable);

    UCDB_PORT virtual UcDb::GridLineStyle gridLineStyle(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineType) const;
    UCDB_PORT virtual Ucad::ErrorStatus setGridLineStyle(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineTypes,
                                             UcDb::GridLineStyle nLineStyle);
    UCDB_PORT virtual UcDb::LineWeight gridLineWeight(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineType) const;
    UCDB_PORT virtual Ucad::ErrorStatus setGridLineWeight(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineTypes, 
                                             UcDb::LineWeight nLineWeight);
    UCDB_PORT virtual UcDbObjectId gridLinetype(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineType) const;
    UCDB_PORT virtual Ucad::ErrorStatus setGridLinetype(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineTypes, 
                                             const UcDbObjectId& idLinetype);
    UCDB_PORT virtual UcCmColor gridColor   (int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineType) const;
    UCDB_PORT virtual Ucad::ErrorStatus setGridColor(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineTypes, 
                                             const UcCmColor& color);
    UCDB_PORT virtual UcDb::Visibility gridVisibility(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineType) const;
    UCDB_PORT virtual Ucad::ErrorStatus setGridVisibility(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineTypes, 
                                             UcDb::Visibility nVisibility);
    UCDB_PORT virtual double gridDoubleLineSpacing(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineType) const;
    UCDB_PORT virtual Ucad::ErrorStatus setGridDoubleLineSpacing(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineTypes, 
                                             double fSpacing);
    UCDB_PORT virtual Ucad::ErrorStatus getGridProperty(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineType, 
                                             UcGridProperty& gridProp) const;
    UCDB_PORT virtual Ucad::ErrorStatus setGridProperty(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineTypes, 
                                             const UcGridProperty& gridProp);
    UCDB_PORT virtual Ucad::ErrorStatus setGridProperty(const UcCellRange& range,
                                             UcDb::GridLineType nGridLineTypes, 
                                             const UcGridProperty& gridProp);

    UCDB_PORT virtual UcDb::CellProperty getOverride(int nRow, 
                                             int nCol, 
                                             int nContent) const;
    UCDB_PORT virtual UcDb::GridProperty getOverride(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineType) const;
    UCDB_PORT virtual Ucad::ErrorStatus setOverride(int nRow, 
                                             int nCol, 
                                             int nContent, 
                                             UcDb::CellProperty nOverride);
    UCDB_PORT virtual Ucad::ErrorStatus setOverride(int nRow, 
                                             int nCol, 
                                             UcDb::GridLineType nGridLineType, 
                                             UcDb::GridProperty nOverride);
    UCDB_PORT virtual Ucad::ErrorStatus removeAllOverrides(int nRow, 
                                             int nCol);

    UCDB_PORT virtual Ucad::ErrorStatus dwgInFields(UcDbDwgFiler* pFiler);
    UCDB_PORT virtual Ucad::ErrorStatus dwgOutFields(UcDbDwgFiler* pFiler) const;
    UCDB_PORT virtual Ucad::ErrorStatus dxfInFields(UcDbDxfFiler* pFiler);
    UCDB_PORT virtual Ucad::ErrorStatus dxfOutFields(UcDbDxfFiler* pFiler) const;
};
